<?php

use Symfony\Component\Yaml\Yaml;

$env = Yaml::parseFile(ROOT_PATH . 'env.yaml');

$_ENV = [
    'app_name' => $env['APP']['NAME'] ?? 'mall',
    'app_host' => $env['APP']['HOST'] ?? 'http://localhost',
    'app_debug' => $env['APP']['DEBUG'] ?? false,
    'app_timezone' => $env['APP']['TIMEZONE'] ?? '',
    'app_key' => $env['APP']['KEY'] ?? '',

    'database' => [
        'driver' => 'mysql',
        'host' => $env['DATABASE']['DB_HOST'] ?? '127.0.0.1',
        'port' => $env['DATABASE']['DB_PORT'] ?? 3306,
        'database' => $env['DATABASE']['DB_DATABASE'] ?? 'test',
        'username' => $env['DATABASE']['DB_USERNAME'] ?? 'root',
        'password' => $env['DATABASE']['DB_PASSWORD'] ?? '',
        'charset' => $env['DATABASE']['DB_CHARSET'] ?? 'utf8mb4',
        'collation' => $env['DATABASE']['DB_COLLATION'] ?? 'utf8mb4_unicode_ci',
        'prefix' => $env['DATABASE']['DB_PREFIX'] ?? '',
        'strict' => $env['DATABASE']['DB_STRICT_MODE'] ?? true,
        // 'timezone' => $env['DATABASE']['DB_TIMEZONE'] ?? '+00:00',
    ],

    'redis' => [
        'host' => $env['REDIS']['REDIS_HOST'] ?? '127.0.0.1',
        'port' => $env['REDIS']['REDIS_PORT'] ?? 6379,
        'password' => $env['REDIS']['REDIS_PASSWORD'] ?? null,
        'database' => $env['REDIS']['REDIS_DB'] ?? 0,
        'prefix' => $env['REDIS']['REDIS_PREFIX'] ?? '',
    ],
];

unset($env);
